<?php
namespace app\validators;
use app\models\Member;
use yii\validators\Validator;

/**
 * 手机找回密码验证器
 * Class SmscodeValidator
 */
class PhoneforgetpwValidator extends Validator
{
  public function validateAttribute($model, $attribute)
	{
	   $phone = $model->phone;
     $name=$model->name;
		 $member = Member::find()->where([
			'name' =>$name,
      'phone'=>$phone,
		 ])->one();
		if(is_null($member)){
			$this->addError($model, $attribute,'手机号码不匹配');
		}
	}

}
